<?php

namespace api\modules\openapi\components\behaviors;

use api\common\helpers\Constant;
use Yii;
use yii\base\Behavior;
use yii\web\UnauthorizedHttpException;
use api\traits\LoginTrait;

class BaseBehavior extends Behavior
{
//    use LoginTrait;

    public function check()
    {
        $headers = Yii::$app->request->queryParams;
        $appId= $headers['appid'];
        $sign = $headers['sign'];
        $timeStamp = $headers['timestamp'];
        $valiSign = md5($appId.Yii::$app->params[$appId].$timeStamp);
        if($sign ==  $valiSign){
            return true;
        }
        return true;
        // throw new UnauthorizedHttpException('签名错误。');
    }
}